-- bottom_click
-- create by cheny3
-- 主地图底部按钮点击

return {
    -- 判断
    canTrigger = function(args)
        -- 在主地图上才可以
        local uiForm = AutoOperationM.getCurForm();
        local formName = uiForm:getName();
        return formName == "UIMainMap";
    end,

    -- 触发
    trigger = function(args)
        local uiForm = UIMgr.getCurrentScene():getFormByName("UIBottomMenu");
        -- 五个按钮
        local list = {};
        for i = 1, 5 do
            local node = findChildByName(uiForm.node, "panel/bg"..i);
            table.insert(list, node);
        end

        -- 打乱顺序
        list = AutoOperationM.randomArr(list);
        local clickNode = list[1];
        AutoOperationM.dispatchClickEvent(clickNode);
        return true;
    end,
};
